home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / fileutil.zip / MAKEFILE.UNX < prev    next >
Text File  |  1990-09-09  |  10KB  |  289 lines

  1. # Makefile for the GNU file utilities.
  2. # Copyright (C) 1986, 1988, 1989, 1990 Free Software Foundation, Inc.
  3.  
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 1, or (at your option)
  7. # any later version.
  8.  
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. # GNU General Public License for more details.
  13.  
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. SHELL = /bin/sh
  19. # If you use gcc, you should either run the fixincludes script that
  20. # comes with it or else use gcc with the -traditional option.  Otherwise
  21. # ioctl calls will be compiled incorrectly on some systems.
  22. CC = gcc -O
  23.  
  24. YACC = bison -y
  25.  
  26. # Things you might add to DEFS:
  27. # -DSTDC_HEADERS    If you have ANSI C headers and libraries.
  28. # -D_POSIX_SOURCE    If you have POSIX.1 headers and libraries.
  29. #            Also need to define -DDIRENT.
  30. # -DSIGTYPE=int        If your signal handlers return int, not void.
  31. # -DUSG            System V strings, headers, ndir.h.
  32. # -DDIRENT        If you have dirent.h.
  33. # -DSYSNDIR        Old Xenix systems (selects sys/ndir.h).
  34. # -DINT_16_BITS        If sizeof long > sizeof int.
  35. # -DHPUX_NFS_BUG    On HP/UX (6.5 at least) where NFS files have
  36. #            reported st_blocks twice the correct size.
  37. # -DVPRINTF_MISSING    If you lack vprintf function (but have _doprnt).
  38. # -DDOPRNT_MISSING    If you lack _doprnt function.  Also need to define
  39. #            -DVPRINTF_MISSING.
  40. # -DMKTIME_MISSING    If you lack mktime function.
  41. # -DMKDIR_MISSING    If you lack mkdir and rmdir system calls.
  42. # -DMKFIFO_MISSING    If you lack mkfifo system call, but have FIFOs.
  43. # -DFCHMOD_MISSING    If you lack fchmod system call.
  44. # -DRENAME_MISSING    If you lack rename system call.
  45. # -DSTBLOCKS_MISSING    If your `struct stat' lacks st_blocks and st_blksize.
  46. # -DUTIME_NULL_MISSING    If your utime system call does not use the
  47. #            current time when passed a null time pointer.
  48.  
  49. # BSD
  50. #DEFS = -DSIGTYPE=int -DVPRINTF_MISSING -DUTIME_NULL_MISSING \
  51. #    -DMKTIME_MISSING -DMKFIFO_MISSING
  52. #LIBS = $(LIBOBJS)
  53.  
  54. # SunOS 4.[01]
  55. DEFS = -DDIRENT -DMKTIME_MISSING -DMKFIFO_MISSING
  56. LIBS = $(LIBOBJS)
  57.  
  58. # Ultrix 4.0
  59. #DEFS = -DDIRENT
  60. #LIBS = $(LIBOBJS)
  61.  
  62. # Typical System V
  63. #DEFS = -DUSG -DMKDIR_MISSING -DFCHMOD_MISSING -DMKTIME_MISSING \
  64. #    -DRENAME_MISSING -DSTBLOCKS_MISSING -DMKFIFO_MISSING \
  65. #    -DMVDIR=\"$(LIBDIR)/mvdir\"
  66. #LIBPROGS = mvdir
  67. #LIBINSTALL = install_lib
  68. # Non-gcc users need -lPW to get alloca.
  69. #LIBS = $(LIBOBJS) -lndir #-lPW
  70.  
  71. # SCO Xenix 386
  72. # Recent versions have both sys/dir.h, linked with -lx,
  73. # and dirent.h, linked with -ldir.  In some versions, the -ldir
  74. # library is buggy.  But the -ldir routines are the only way to
  75. # access network disks.
  76. # The current version of regex.c appears to fun afoul of a bug in the
  77. # Microsoft C compiler; you might need gcc to compile it on Xenix.
  78. #DEFS = -DUSG -DFCHMOD_MISSING -DMKTIME_MISSING -DMKFIFO_MISSING \
  79. #    -DRENAME_MISSING -DSTBLOCKS_MISSING \
  80. #    -DDIRENT -DMVDIR=\"$(LIBDIR)/mvdir\"
  81. #LIBPROGS = mvdir
  82. #LIBINSTALL = install_lib
  83. # Non-gcc users need to get alloca from somewhere, like emacs or bash,
  84. # and add alloca.o to LIBOBJS.
  85. #LIBS = $(LIBOBJS) -ldir -lx
  86.  
  87. # HP/UX
  88. #DEFS = -DUSG -DVPRINTF_MISSING -DMKTIME_MISSING -DMKFIFO_MISSING \
  89. #    -DHPUX_NFS_BUG
  90. #LIBS = $(LIBOBJS)
  91.  
  92. # Minix with gcc
  93. #DEFS = -DUSG -DSTDC_HEADERS -D_POSIX_SOURCE -DFCHMOD_MISSING -DDIRENT \
  94. #    -DFTRUNCATE_MISSING -DSTBLOCKS_MISSING -DDEV_BSIZE=1024 -D_MINIX
  95. #LIBS = $(LIBOBJS)
  96.  
  97. CFLAGS = -I. -g $(DEFS)
  98. LDFLAGS = -g
  99.  
  100. # Object files that are linked with every program except dd.
  101. LIBOBJS = getopt.o getopt1.o
  102.  
  103. # Where to install the executables.
  104. BINDIR = /usr/local/gnubin
  105. # Where to put mvdir on systems lacking the rename system call.
  106. LIBDIR = /usr/local/lib
  107. # Where to put the Unix-style manual pages.
  108. MANDIR = /usr/local/man/man1
  109.  
  110. # Executable files in this directory.
  111. PROGS = cat chmod cmp cp cut dd du ginstall head ln dir vdir ls \
  112.     mkdir mkfifo mv paste rm rmdir tac tail touch
  113.  
  114. # Version of fileutils release.
  115. VERSION = 1.4
  116.  
  117. MISC = COPYING ChangeLog Makefile README
  118. SRC = backupfile.c cat.c chmod.c cmp.c cp-aux.c cp-hash.c cp.c cp.h \
  119.     dd.c dirlib.c du.c eaccess.c error.c filemode.c \
  120.     getopt.c getopt1.c globmat.c head.c ln.c ls.c mkdir.c mkfifo.c \
  121.     modechange.c modechange.h mv.c mvdir.c rm.c rmdir.c tail.c \
  122.     tac.c regex.c getversion.c argmatch.c fileblocks.c install.c \
  123.     touch.c getdate.y posixtime.y mktime.c \
  124.     cut.c paste.c savedir.c backupfile.h getopt.h system.h regex.h
  125. MAN = man/gcat.1 man/gcut.1 man/ginstall.1 man/gmkfifo.1 man/grmdir.1 \
  126.     man/gchmod.1 man/gdd.1 man/gln.1 man/gmv.1 man/gtac.1 \
  127.     man/gcmp.1 man/gdu.1 man/gls.1 man/gpaste.1 man/gtail.1 \
  128.     man/gcp.1 man/ghead.1 man/gmkdir.1 man/grm.1 man/gtouch.1
  129. # Files to include in the distribution archive.
  130. DISTFILES = $(MISC) $(SRC) $(MAN)
  131.  
  132. # The name of the distribution archive.
  133. TARFILE = fileutils-$(VERSION).tar.Z
  134.  
  135. all: $(PROGS) $(LIBPROGS)
  136. .PHONY: all
  137.  
  138. $(PROGS) $(LIBPROGS):    $(LIBOBJS)
  139.  
  140. install:    install_progs $(LIBINSTALL) install_man 
  141. .PHONY: install
  142.  
  143. install_progs: $(PROGS)
  144.     ./ginstall $(PROGS) $(BINDIR)
  145.     cd $(BINDIR); ./ln -f dir d; ./ln -f vdir v; ./mv -f ginstall install
  146. .PHONY: install_progs
  147.  
  148. install_lib:    $(LIBPROGS)
  149.     ./ginstall -o root -m 4755 $(LIBPROGS) $(LIBDIR)
  150. .PHONY: install_lib
  151.  
  152. install_man: $(MAN)
  153.     ./ginstall -m 644 $(MAN) $(MANDIR)
  154. .PHONY: install_man
  155.  
  156. # Linking rules.
  157.  
  158. cat: cat.o error.o
  159.     $(CC) $(LDFLAGS) -o $@ cat.o error.o $(LIBS)
  160.  
  161. chmod: chmod.o modechange.o filemode.o error.o savedir.o
  162.     $(CC) $(LDFLAGS) -o $@ chmod.o modechange.o filemode.o error.o \
  163.     savedir.o $(LIBS)
  164.  
  165. cmp: cmp.o error.o
  166.     $(CC) $(LDFLAGS) -o $@ cmp.o error.o $(LIBS)
  167.  
  168. cp: cp.o cp-hash.o cp-aux.o dirlib.o eaccess.o error.o backupfile.o \
  169.     getversion.o argmatch.o savedir.o
  170.     $(CC) $(LDFLAGS) -o $@ cp.o cp-hash.o cp-aux.o dirlib.o \
  171.     eaccess.o error.o backupfile.o getversion.o argmatch.o \
  172.     savedir.o $(LIBS)
  173.  
  174. cut: cut.o error.o
  175.     $(CC) $(LDFLAGS) -o $@ cut.o error.o $(LIBS)
  176.  
  177. dd: dd.o error.o
  178.     $(CC) $(LDFLAGS) -o $@ dd.o error.o
  179.  
  180. dir: dir.o filemode.o globmat.o error.o argmatch.o fileblocks.o
  181.     $(CC) $(LDFLAGS) -o $@ dir.o filemode.o globmat.o error.o \
  182.     argmatch.o fileblocks.o $(LIBS)
  183.  
  184. du: du.o error.o fileblocks.o savedir.o
  185.     $(CC) $(LDFLAGS) -o $@ du.o error.o fileblocks.o savedir.o $(LIBS)
  186.  
  187. ginstall: install.o dirlib.o error.o
  188.     $(CC) $(LDFLAGS) -o $@ install.o dirlib.o error.o $(LIBS)
  189.  
  190. head: head.o error.o
  191.     $(CC) $(LDFLAGS) -o $@ head.o error.o $(LIBS)
  192.  
  193. ln: ln.o error.o backupfile.o getversion.o dirlib.o argmatch.o
  194.     $(CC) $(LDFLAGS) -o $@ ln.o error.o backupfile.o \
  195.     getversion.o dirlib.o argmatch.o $(LIBS)
  196.  
  197. ls: ls.o filemode.o globmat.o error.o argmatch.o fileblocks.o
  198.     $(CC) $(LDFLAGS) -o $@ ls.o filemode.o globmat.o error.o \
  199.     argmatch.o fileblocks.o $(LIBS)
  200.  
  201. mkdir: mkdir.o modechange.o dirlib.o error.o
  202.     $(CC) $(LDFLAGS) -o $@ mkdir.o modechange.o dirlib.o error.o $(LIBS)
  203.  
  204. mkfifo: mkfifo.o modechange.o error.o
  205.     $(CC) $(LDFLAGS) -o $@ mkfifo.o modechange.o error.o $(LIBS)
  206.  
  207. mv: mv.o error.o backupfile.o getversion.o dirlib.o argmatch.o
  208.     $(CC) $(LDFLAGS) -o $@ mv.o error.o backupfile.o \
  209.     getversion.o dirlib.o argmatch.o $(LIBS)
  210.  
  211. mvdir: mvdir.o error.o
  212.     $(CC) $(LDFLAGS) -o $@ mvdir.o error.o
  213.  
  214. paste: paste.o error.o
  215.     $(CC) $(LDFLAGS) -o $@ paste.o error.o $(LIBS)
  216.  
  217. rm: rm.o dirlib.o eaccess.o error.o
  218.     $(CC) $(LDFLAGS) -o $@ rm.o dirlib.o eaccess.o error.o $(LIBS)
  219.  
  220. rmdir: rmdir.o dirlib.o error.o
  221.     $(CC) $(LDFLAGS) -o $@ rmdir.o dirlib.o error.o $(LIBS)
  222.  
  223. tac: tac.o error.o regex.o
  224.     $(CC) $(LDFLAGS) -o $@ tac.o error.o regex.o $(LIBS)
  225.  
  226. tail: tail.o error.o
  227.     $(CC) $(LDFLAGS) -o $@ tail.o error.o $(LIBS)
  228.  
  229. touch: touch.o getdate.o posixtime.o mktime.o error.o argmatch.o
  230.     $(CC) $(LDFLAGS) -o $@ touch.o getdate.o posixtime.o \
  231.     mktime.o error.o argmatch.o $(LIBS)
  232.  
  233. vdir: vdir.o filemode.o globmat.o error.o argmatch.o fileblocks.o
  234.     $(CC) $(LDFLAGS) -o $@ vdir.o filemode.o globmat.o error.o \
  235.     argmatch.o fileblocks.o $(LIBS)
  236.  
  237. # Compilation rules.
  238.  
  239. chmod.o mkdir.o mkfifo.o modechange.o: modechange.h
  240.  
  241. cp.o mv.o ln.o backupfile.o getversion.o: backupfile.h
  242.  
  243. cp.o cp-hash.o cp-aux.o: cp.h
  244.  
  245. tac.o regex.o: regex.h
  246.  
  247. getdate.c: getdate.y
  248.     @echo expect 8 shift/reduce conflicts
  249.     $(YACC) getdate.y
  250.     mv y.tab.c getdate.c
  251.  
  252. posixtime.c: posixtime.y
  253.     $(YACC) posixtime.y
  254.     sed -e 's/yy/zz/g' y.tab.c > posixtime.c
  255.     rm y.tab.c
  256.  
  257. # C compilers that can't handle -c and -o together need the following:
  258. #dir.o:        ls.c
  259. #    $(CC) $(CFLAGS) -DMULTI_COL -c ls.c
  260. #    mv ls.o dir.o
  261. #
  262. #vdir.o:        ls.c
  263. #    $(CC) $(CFLAGS) -DLONG_FORMAT -c ls.c
  264. #    mv ls.o vdir.o
  265.  
  266. dir.o:        ls.c
  267.     $(CC) $(CFLAGS) -DMULTI_COL -o dir.o -c ls.c
  268.  
  269. vdir.o:        ls.c
  270.     $(CC) $(CFLAGS) -DLONG_FORMAT -o vdir.o -c ls.c
  271.  
  272. # Use /bin/rm instead of ./rm in case ./rm is compiled for a different
  273. # architecture.
  274. clean:
  275.     /bin/rm -f $(PROGS) $(LIBPROGS) *.o tags TAGS a.out core \
  276.     posixtime.c getdate.c
  277. .PHONY: clean
  278.  
  279. dist:    $(TARFILE)
  280. .PHONY: dist
  281.  
  282. $(TARFILE):    $(DISTFILES)
  283.     rm -rf fileutils-$(VERSION)
  284.     mkdir fileutils-$(VERSION) fileutils-$(VERSION)/man
  285.     ln $(MISC) $(SRC) fileutils-$(VERSION)
  286.     ln $(MAN) fileutils-$(VERSION)/man
  287.     tar chZf $(TARFILE) fileutils-$(VERSION)
  288.     rm -rf fileutils-$(VERSION)
  289.